define(function (require, exports, module) {
	
	var HandlerBars = require("handlebars");
	var cartEvents = require("../handler/cartEvents");
	var changePayTpl = require("../assets/tpl/change_pay.tpl");
	var i18ns = require("i18n");
	
    var instance = {
    	initPayPage:function(widget){
    		changePayTpl = changePayTpl.replace(/积分/g,i18ns.get("bonuspoint_name","积分")).replace(/会员/g,i18ns.get("member_name","会员"));//替换Tpl内的字符串
    		var html = HandlerBars.compile(changePayTpl)();
    		$("#change-pay-center").html(html);
    		$("#totalAmount").html($("#total-price").html().substring(1));
    	},
    	//按钮选择方法
        selectPayType: function (e,widget) {
        	if(!$(e.currentTarget).hasClass("active")){
        		$(".pay-type-button").removeClass("active");
        		$(e.currentTarget).addClass("active");
        		
        		switch (e.currentTarget.id) {
					case "expenseCard":
						//消费卡
						widget.hide(["#idNumber-form-group"]).show(["#cardNumber-form-group","#balance-form-group"]);
						$("#cardNumber").focus();
						break;
					case "cash":
						//现金
						widget.show(["#idNumber-form-group"]).hide(["#cardNumber-form-group","#balance-form-group"]);
						$("#idNumber").focus();
						break;
					case "wipeCard":
						//刷卡
						widget.show(["#idNumber-form-group"]).hide(["#cardNumber-form-group","#balance-form-group"]);
						$("#idNumber").focus();
						break;
				};
				$("#idNumber").val("");
				$("#cardNumber").val("");
				$("#memberName").text("");
				$("#balance").text("");
                $("#memberPicture").prop("src","assets/eling/elcms/pos/productitem/src/assets/img/header.png");
				
        		this.initMemberInfo(widget);
        		return true;
    		}else{
    			return false;
    		}
        },
        initMemberInfo:function(widget){
        	
        },
        
        
    };
    module.exports = instance;
});
